package com.alogic.matcher.impl;

import com.alogic.matcher.CommonMatcher;
import com.anysoft.util.Properties;
import com.anysoft.util.StringMatcher;

/**
 * 通配符*匹配
 *
 * @since 1.6.12.57 [20200103]
 */
public class Wildcard implements CommonMatcher {

    /**
     * 支持*通配符的StringMatcher
     */
    protected StringMatcher matcher = null;

    public Wildcard(String regex, Properties p){
        matcher = new StringMatcher(regex);
    }

    @Override
    public boolean isMatch(String data) {
        return matcher != null?matcher.match(data):false;
    }
}
